%% -*- erlang -*-
[
 {kernel,
  [
   %% force distributed erlang to only run on localhost
   {inet_dist_use_interface, {127,0,0,1}}
  ]},
 {lager,
  [
   {suppress_supervisor_start_stop, true},
   {log_root, "/var/log/miner"},
   {crash_log, "crash.log"},
   {colored, true},
   {metadata_whitelist, [poc_id]},
   {handlers,
    [
     {lager_file_backend, [{file, "console.log"}, {level, info},
                           {formatter, lager_default_formatter},
                           {formatter_config, [date, " ", time, " ", {pterm, ospid, <<"NOPID">>},
                                               " [",severity,"] ",
                                               pid, "@", module, ":", function, ":", line, " ",
                                               message, "\n"]}]},
     {lager_file_backend, [{file, "error.log"}, {level, error}]}
    ]}
  ]},
 {libp2p,
  [
   {node_aliases,
    [
     {"/p2p/112qB3YaH5bZkCnKA5uRH7tBtGNv2Y5B4smv1jsmvGUzgKT71QpE", "/ip4/52.8.80.146/tcp/2154"}
    ]}
  ]},
 {blockchain,
  [
   {honor_quick_sync, true},
   {quick_sync_mode, blessed_snapshot},
   {blessed_snapshot_block_height, 776161},
   {blessed_snapshot_block_hash,
     <<85,194,190,209,28,124,38,136,41,130,74,177,9,15,196,148,207,227,109,36,106,222,180,175,156,15,133,241,91,166,217,177>>},
   {port, 44158},
   {key, {ecc, [{key_slot, 0}, {onboarding_key_slot, 15}]}}, %% don't make this the last line in the stanza because sed and keep it on one line
   {base_dir, "/var/data"},
   {onboarding_dir, "/mnt/uboot"},
   {num_consensus_members, 16},
   {seed_nodes, "/ip4/35.166.211.46/tcp/2154,/ip4/44.236.95.167/tcp/2154"},
   {seed_node_dns, "seed.helium.foundation"},
   {peerbook_update_interval, 900000},
   {max_inbound_connections, 6},
   {outbound_gossip_connections, 2},
   {peerbook_allow_rfc1918, false},
   {metadata_fun, fun miner_util:metadata_fun/0},
   {relay_limit, 50},
   {gw_cache_retention_limit, 0},
   {gw_context_cache_max_size, 15}
  ]},
 {relcast,
  [
   {db_open_opts,
    [{total_threads, 4},
     {max_background_jobs, 2},
     {max_background_compactions, 2}
     %% {max_background_flushes, 2}, % not sure if needed
    ]},
   {defer_count_threshold, 30},
   {defer_time_threshold, 1000}
  ]},
 {rocksdb,

  [{global_opts,
    [
     {max_open_files, 128},
     {compaction_style, universal},
     {block_based_table_options, [{cache_index_and_filter_blocks, true}]},
     {memtable_memory_budget, 8388608},  % 8MB
     {arena_block_size, 262144}, % 256kB
     {write_buffer_size, 262144}, % 256kB
     {db_write_buffer_size, 8388608}, % 8MB
     {max_write_buffer_number, 10},
     {keep_log_file_num, 5}
    ]}
  ]},
 {miner,
  [
   {use_ebus, true},
   {batch_size, 2500},
   {curve, 'SS512'},
   {block_time, 60000},
   {update_dir, "/opt/miner/update"},
   {election_interval, 30},
   {radio_device, { {127,0,0,1}, 1680,
                    {127,0,0,1}, 31341} },
   {default_routers, ["/p2p/112qB3YaH5bZkCnKA5uRH7tBtGNv2Y5B4smv1jsmvGUzgKT71QpE"]},
   {mark_mods, [miner_hbbft_handler]},
   {stabilization_period, 50000},
   {reg_domains_file, "countries_reg_domains.csv"},
   {frequency_data, #{'US915' => [903.9, 904.1, 904.3, 904.5, 904.7, 904.9, 905.1, 905.3],
                      'EU868' => [867.1, 867.3, 867.5, 867.7, 867.9, 868.1, 868.3, 868.5],
                      'EU433' => [433.175, 433.375, 433.575],
                      'CN470' => [486.3, 486.5, 486.7, 486.9, 487.1, 487.3, 487.5, 487.7 ],
                      'CN779' => [779.5, 779.7, 779.9],
                      'AU915' => [916.8, 917.0, 917.2, 917.4, 917.5, 917.6, 917.8, 918.0, 918.2],
                      'AS923' => [923.2, 923.4, 923.6, 923.8, 924.0, 924.2, 924.4, 924.5, 924.6, 924.8],
                      'KR920' => [922.1, 922.3, 922.5, 922.7, 922.9, 923.1, 923.3],
                      'IN865' => [865.0625, 865.4025, 865.985],
                      'RU864' => [864.1, 864.3, 864.5, 864.7, 864.9, 868.9, 869.1]}
   }
  ]}
].
